package com.hengpeng.itfinoss.util;

import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

public class RequestUtil
{
	/**
	 * <pre>
	 * 把request域中的参数封装到map集合中
	 * </pre>
	 * @param request request请求域
	 * @return 参数map集合
	 */
	public static Map<String, Object> fileParmas(HttpServletRequest request)
	{
		Map<String, Object> params = new HashMap<String, Object>();
		Enumeration<?> paramNames = request.getParameterNames();
		while (paramNames.hasMoreElements())
		{
			String paramName = (String) paramNames.nextElement();
			String[] paramValues = request.getParameterValues(paramName);
			if (paramValues.length == 1)
			{
				String paramValue = paramValues[0];
				if (paramValue.length() != 0)
				{
					params.put(paramName, paramValue);
				}
			}
		}
		return params;
	}
}
